package com.example.demo.common.r2dbc;

import org.springframework.data.domain.Pageable;
import org.springframework.data.relational.core.query.Query;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@NoRepositoryBean
public interface BaseRepository<T,  ID> extends ReactiveCrudRepository<T, ID> {

    /**
     *
     * @param query
     * @return
     */
    Mono<T> findOneWithQuery(Query query);

    /**
     *
     * @param query
     * @return
     */
    Flux<T> findListWithQuery(Query query);


    /**
     *
     * @param pageable
     * @return
     */
    Flux<T> findListWithPage(Pageable pageable);

    /**
     *
     * @param query
     * @param pageable
     * @return
     */
    Flux<T> findListWithQueryAndPage(Query query, Pageable pageable);
}
